{% extends "AcmeLikipeBlogBundle::Common/layout.html.twig" %}


{% block title %}
 List posts of Blog: {{ blog.title }}
{% endblock %}

{% block content %}

{% if posts|length == 0 %}
<h1>No found Post in Blog with id {{ blog.id }}</h1>
{% else %}

{% if app.session.hasFlash('notice') %}
<span style="color: red">{{ app.session.flash('notice') }}</span>
{% endif %}
<h1>List Posts</h1>

<table border="5">
	<tr>
		<th>STT</th>
		<th>ID</th>
		<th class="list_blogs">CONTENT</th>
		<th>CREATED</th>
		<th>AUTHOR</th>
		<th>ACTION</th>
	</tr>
	{% for key, post in posts %}
	<tr>
		<td>{{ key + 1 }}</td>
		<td>{{ post.id }}</td>
		<td><a href="{{ path('AcmeLikipeBlogBundle_comment', {'iId': post.id}) }}">{{ post.content }}</a></td>
		<td>{{ post.created|date('d/m/y') }}</td>
		<td style="text-align: center;">{{ post.author }}</td>
		<td style="text-align: center;">
			<a href="{{ path('AcmeLikipeBlogBundle_post_delete', {'iId': post.id}) }}" onclick="if (! confirm('You are sure to delete this Post?')) return false;">
				<img style="width: 32px; heigth: 32px;" alt="Delete post with id {{ post.id }}" src="{{ asset('likipe/img/button_delete.png') }}">
			</a>
			<a href="{{ path('AcmeLikipeBlogBundle_post_edit', {'iId': post.id}) }}">
				<img style="width: 32px; heigth: 32px;" alt="Edit post with id {{ post.id }}" src="{{ asset('likipe/img/button_edit.png') }}">
			</a>
		</td>
	</tr>
	{% endfor %}
</table>

{% endif %}
<br /><br />
<a style="font-size: 20px; font-family: Brush Script Std;" href="{{ path('AcmeLikipeBlogBundle_post_add', {'iId': blog.id}) }}">Add new Post</a>
<br /><br />
{% endblock %}


